import Vue from 'vue'
export const has = function () {
  Vue.directive('has', {
    inserted: function (el, binding) {
      console.log(Vue.prototype.$_has(binding.value))
      if (Vue.prototype.$_has(binding.value)) {
        console.log('删除')
        if (el.parentNode) {
          el.parentNode.removeChild(el)
        }
      }
    }
  })
  Vue.prototype.$_has = function (value) {
    let btnPremissions = [1, 2, 3, 4]
    if (btnPremissions.length === 0) {
      return false
    } else {
      if (btnPremissions.indexOf(value) === -1) {
        return false
      } else {
        return true
      }
    }
  }
}
